package work20241129;

import java.util.Arrays;

/**
 * @author zdl
 * @date 2024/11/29
 */
public class Demo1 {
    public static void main(String[] args) {
        int[] arr ={1,2,3,4};
        int[] arr1 = Arrays.copyOf(arr,4);
        int[] arr2 = new int[arr.length];
        System.arraycopy(arr,0,arr2,0,2);
        System.out.println(Arrays.toString(arr1));
        System.out.println(Arrays.toString(arr2));
    }
}
